﻿package app.view 
{
	import app.ApplicationFacade;
	import app.model.vo.SectionVO;
	import app.view.BaseMediator;
	import app.view.events.UIEvent;
	import app.view.managers.SectionsManager;
	import org.puremvc.interfaces.INotification;
	
	/**
	 * Медиатор для менеджера секций
	 * @author firsoff maxim, snzflash.com, tel: +79222345364, skype: maxim.firsoff
	 */
	public class SectionsManagerMediator extends BaseMediator
	{
		public static const NAME:String = "SectionsManagerMediator";
		
		public function SectionsManagerMediator(viewComponent:Object = null) 
		{
			super(NAME, viewComponent);
			
			
		};
		
		
		override public function listNotificationInterests():Array 
		{
			return [ApplicationFacade.CHANGE_SECTION, ApplicationFacade.CHANGE_LANG];
		};
		
		override public function handleNotification(notification:INotification):void 
		{
			super.handleNotification(notification);
			switch ( notification.getName() ) 
            {  
				case ApplicationFacade.CHANGE_SECTION:
					manager.change( notification.getBody() as SectionVO);
				break;
				
				case ApplicationFacade.CHANGE_LANG:
					manager.change( null );
				break;
            };
		};
		
		public function get manager():SectionsManager { return viewComponent as SectionsManager; };
		
	};
};